package executable.instance;

public class ClassWithNull {

    private ClassWithNull reference;

    public static void testNullIf() {
        ClassWithNull classWithNull = null;
        if (classWithNull != null) {
            throw new RuntimeException("");
        }
    }

    public static void testNullIf2() {
        ClassWithNull classWithNull = new ClassWithNull();
        if (classWithNull == null) {
            throw new RuntimeException("");
        }
    }

    public static void testSetNull() {
        ClassWithNull classWithNull = new ClassWithNull();
        classWithNull = null;
        if (classWithNull != null) {
            throw new RuntimeException("test fail");
        }
    }

    public static void testSetNull2() {
        ClassWithNull classWithNull = new ClassWithNull();
        classWithNull = null;
        classWithNull = new ClassWithNull();
        if (classWithNull == null) {
            throw new RuntimeException("test fail");
        }
    }

    public static void testSetNullToReference() {
        ClassWithNull classWithNull = new ClassWithNull();
        classWithNull = null;
        if (classWithNull != null) {
            throw new RuntimeException("test fail");
        }
    }

    public static void testArrayInitNull() {
        final ClassWithNull[] classWithNulls = new ClassWithNull[10];
        if (classWithNulls[5] != null) {
            throw new RuntimeException("test fail");
        }
    }

}
